﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using secondhand.L3object;
using System.Data;
using secondhand.L1database;
using secondhand.L2busslogic;

namespace secondhand.L4view
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button5_Click(object sender, EventArgs e)
        {
            if (TextBox1.Text == "")
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('用户名不能为空 ');</script>");
                return;
            }
            if (TextBox2.Text == "")
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('密码不能为空 ');</script>");
                return;
            }
            if (TextBox3.Text == "")
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('电话号码不能为空 ');</script>");
                return;
            }
            if (TextBox4.Text == "")
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('邮箱不能为空 ');</script>");
                return;
            }
            userOB mydd = new userOB();
            mydd.user_name = TextBox1.Text;
            mydd.pass_word = TextBox2.Text;
            mydd.user_num = TextBox3.Text;
            mydd.user_mail = TextBox4.Text;
            mydd.user_count = "0";
            mydd.usable_count = "0";
            mydd.freeze_count = "0";
            if (!userBL.Addfill(mydd))
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('注册不成功 ');</script>");
                return;
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('注册成功');{location.href='yonghu_login.aspx'}</script>");
                return;
            }
        }
    }
}